<template>
  <div>
    <div class="title font14 ma30-15">
      <p>管理的团队</p>
    </div>
    <div class="pa15 bor7 group">
      <!-- 内容 -->
      <div class="table-responsive">
        <table class="table">
          <tbody>
            <tr>
              <th>团队海报</th>
              <th>团队名称</th>
              <th>省市区</th>
              <th>浏览量</th>
              <th>组织活动</th>
              <th>成立时间</th>
              <th>角色</th>
              <th>操作</th>
            </tr>
            <tr v-for="itemList in this.defaultList" :key="itemList.id">
              <td>
                <img class="height_2"  :src="$api + itemList.team.image" alt />
              </td>
              <td>{{ itemList.team.name }}</td>
              <td>{{ itemList.team.city }}</td>
              <td>{{ itemList.team.views }}</td>
              <td>{{ itemList.team.activity_num }}</td>
              <td>{{ itemList.team.create_time | formatDate }}</td>
              <td v-if="itemList.is_aide == '-1'">副管理员</td>
              <td v-else>副管理员</td>
              <td>
                <!--router-link
                    :to="{ path: '/activities_detail', query: { id: itemList.id } }"
                    class="primary"
                    >详情</router-link
                  -->

 <router-link
                :to="{ path: '/teamdetail', query: { id: itemList.team_id } }"
                  class="primary"
                  >详情</router-link
                >
                <router-link
                  :to="{ path: '/activemanage', query: { id: itemList.team_id } }"
                  class="primary yellow"
                  >活动管理</router-link
                >
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!-- 分页 -->
      <div class="block ta">
        <el-pagination
          layout="  prev, pager, next "
          :page-size="page_size"
          @current-change="current_change"
          :current-page.sync="currentPage"
          :pager-count="5"
          :total="info.total"
          v-if="info.pages > 1"
        >
        </el-pagination>
        <el-empty description="暂无数据" v-if="info.total == 0"></el-empty>
      </div>
    </div>
  </div>
</template>

<script>
import { formatDate } from "../../assets/data.js";
export default {
  // 时间戳
  filters: {
    formatDate(time) {
      time = time * 1000;
      let date = new Date(time);
      return formatDate(date, "yyyy-MM-dd hh:mm:ss");
    },
  },
  data() {
    return {
      isActive: 1,
      defaultList: [],
      info: [], //数据
      page_size: 8, //每页多少数据
      currentPage: 1, //默认当前页为第一页
      sort: "id",
      keyword: "",
      visible1: false,
      visible2: false,
      visible3: false,
      visible4: false,
      visible5: false,
      visible6: false,
      visible7: false,
    };
  },
  mounted() {
    this.getAllList();
  },
  methods: {
    getAllList() {
      var that = this;
      this.$axios
        .get(
          this.$api +
            "//api/my/teamaide?page_no=" +
            that.currentPage +
            "&page_size=" +
            that.page_size
        )
        .then(function (response) {
          that.defaultList = response.data.data.data;
          that.info = response.data.data;
          //console.log(response.data.data);
          //console.log(that.defaultList);
        })
        .catch(function (error) {
          //console.log(error);
        });
    },
    deleteDefault(id) {
      //console.log(1231);
      //console.log(id);
      var that = this;
      this.$axios
        .get(this.$api + "//api/team/del?id=" + id)
        .then(function (response) {
          //that.defaultList = response.data.data.data;
          if (response.data.code == 1) {
            that.$message({
              message: response.data.msg,
              type: "success",
            });
            this.getAllList();
          } else {
            that.$message.error(response.data.msg);
          }
          //console.log(response.data);
        })
        .catch(function (error) {
          //console.log(error);
        });
    },
    current_change(currentPage) {
      //改变当前页
      this.currentPage = currentPage;
      this.getAllList();
    },
    defaultSearch() {
      ////console.log(this.keyword);
      this.getAllList();
    },
  },
};
</script>

<style scoped>
html {
  height: 100% !important;
  overflow-y: hidden !important;
}
.table th {
  border-top: none;
  background: #f6f5f5;
  font-size: 0.875rem;
  color: #545556;
  line-height: 3.4375rem !important;
  text-align: center;
  font-size: 0.875rem;
}
table tr td {
  line-height: 3.4375rem !important;
  text-align: center;
  font-size: 0.875rem;
}
.el-button--info {
  border-radius: 0.25rem;
  background: #f6f5f5;
  border: 1px solid #f6f5f5;
  color: #545556;
}
.el-button {
  padding: 0.3125rem 0.625rem;
  font-size: 0.875rem;
}
.table > tbody > tr > td {
  border-top: 1px solid #f6f5f5;
}
.el-button + .el-button {
  margin-left: 0.25rem;
}
.el-button--success {
  background: #19a15f;
}
.el-radio {
  margin-right: 0.5rem;
}
.el-radio__label {
  font-size: 0.875rem;
  padding-left: 0.3125rem;
}
tr .free {
  color: #de5044;
}
.table tr img {
  width: 3.4375rem;
  object-fit: cover;height: 2rem;
}
.el-button--warning {
  background: #ffce45;
  border-color: #ffce45;
}
</style>
